#include("../../comm/ListHead.html")
<div class="layui-fluid layui-anim layui-anim-scale">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header SearchTable">
                    <p style="float:right"></p>
                    <label class="table-search-title-first">文件ID:</label>
                    <input type="text" id="keyid" lay-verify="required" placeholder="" autocomplete="off"
                           class="table-search-text width80">
                    <label class="table-search-title left10">文件路经:</label>
                    <input type="text" id="title" lay-verify="required" placeholder="" autocomplete="off"
                           class="table-search-text width120">
                    <button class="layui-btn layui-btn-warm layui-btn-sm" lay-event="DoSearch">
                        搜索
                    </button>
                    <button class="layui-btn layui-btn-normal layui-btn-sm" lay-event="DoSearchMore">
                        高级搜索
                    </button>
                </div>
                <div class="layui-card-body">
                    <table class="layui-hide" id="table_1" lay-filter="table_1"></table>

                    <script type="text/html" id="table_1_bar_title">
                        <div class="layui-btn-container">
                            <button class="layui-btn layui-btn-sm btn-add" lay-event="AddSysImage">添加示例</button>
                            <button class="layui-btn layui-btn-sm btn-edit" lay-event="EditSysImage">修改</button>
                            <button class="layui-btn layui-btn-sm btn-del" lay-event="DelSysImage">删除</button>
                        </div>
                    </script>

                    <script type="text/template" id="SearchMoreTemp">
                        <form class="layui-form">
                            <div class="layui-row margin-10" style="z-index:2000">
                                <label class="layui-form-label-col">测试标题</label>
                                <select id="test_type" name="test_type" lay-filter="testtype" style="width:80px">
                                    <option value='' class='select-option-default'></option>
                                    <option value="">数据为空</option>
                                </select>

                            </div>
                            <div class="margin-10">
                                <input type="text" id="d_title" placeholder="请输入标题" autocomplete="off" class="layui-input">
                            </div>
                            <div class="margin-10">
                                <input type="text" id="d_title1" placeholder="请选择时间" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item margin-10">
                                <label class="layui-form-mid">价格</label>

                                <div class="layui-input-inline" style="width:70px">
                                    <input type="text" name="price_now" lay-verify="number" placeholder="优惠价格"
                                           value="" class="layui-input">

                                </div>
                                <label class="layui-form-mid">-</label>

                                <div class="layui-input-inline" style="width:70px">
                                    <input type="text" name="price_base" lay-verify="number" placeholder="商品原价"
                                           value="" class="layui-input">
                                </div>
                            </div>
                        </form>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
<script language="JavaScript">
    var USER_JWT = "";
    var index = 0;
    var myTable, table, tableindex;

    layui.use(['myTable', 'table', 'form', 'util', 'drawer', 'myTool'], function () {
        var $ = layui.$;
        myTable = layui.myTable, table = layui.table
        form = layui.form, util = layui.util, myTool = layui.myTool;

        tableindex = myTable.render({
            elem: '#table_1'
            , height: 520
            , url: 'SysImageListDataApi'
            , toolbar: '#table_1_bar_title'
            , title: '视频库'
            , height: 'full-100'
            , cols: [[
                         {type: 'checkbox', fixed: 'left'}
                         , {field: 'img_id', title: '主键', width: 80}
                         , {field: 'img_name', title: '图片名', width: 80}
                         , {field: 'img_path', title: '路经', width: 80}
                         , {field: 'img_size', title: '图片大小', width: 80}
                         , {field: 'img_ext', title: '扩展名', width: 80}
                         , {field: 'create_time', title: '上传时间', width: 80}
                         , {field: 'save_year', title: '上传年份', width: 80}
                         , {field: 'save_month', title: '上传月份', width: 80}
                         , {field: 'update_user', title: '上专人ID', width: 80}

                     ]]
            , page: true
            , limit: 10
            , editField: {url: 'ModifySysImageFieldApi', key: 'img_id'}
        });

        drawer1 = layui.drawer.render({
            offset: 'r', content: SearchMoreTemp.innerHTML,
            success: function (layero, index) {
// layui.laydate.render({
// elem: '#d_title1'
// });
// layui.form.render('select');
            },
            btn1: function (index, layero) {
                tableindex.reload({
                    where: {
                        s: {
                            m_id: $(layero).find("#d_title1").val(),
                            test_type: $(layero).find("#test_type").val(),
                            m_name: $("#s_supname").val(),
                            m_type: $("#mem_type").val(),
                            m_hall: $("#s_hall").val()
                        }
                    }
                    , page: {curr: 1}
                });
            },
            btn2: function (index, layero) {
                $(layero).find("form")[0].reset();//重置
                return false;
            }
        });


        util.event("lay-event", {
            DoSearch: function () {
                tableindex.reload({
                    where: {
                        s: {
                            keyid: $("#keyid").val(),
                            title: $("#title").val()
                        }
                    }
                    , page: {curr: 1}
                });
            },
            DoSearchMore: function () {
                layui.form.render();
                drawer1.open();
            }
        });

//头工具栏事件
        table.on('toolbar(table_1)', function (obj) {
            myTool.toolbar(this, obj, {
                AddSysImage: function () {
                    index = layer.open({
                        type: 2, offset: '10px', area: ['700px', '550px'], title: ['添加示例数据', 'font-size:15px;'],
                        content: ["AddSysImage", 'no'],
                        end: function () {
                            tableindex.reload({});
                        }
                    });
                }
                , EditSysImage: function () {
                    myTool.doSingleSelect(myTable.checkStatus('table_1'), {}, function (data, keys) {
                        index = layer.open({
                            type: 2, offset: '10px', area: ['700px', '550px'], title: ['修改示例[' + data[0].title + ']', 'font-size:15px;'],
                            content: ["EditSysImage?keyid=" + data[0].keyid, 'no'],
                            end: function () {
                                tableindex.reload({});
                            }
                        });
                    });
                }
                , DelSysImage: function () {
                    myTool.doSingleSelect(myTable.checkStatus('table_1'), {}, function (data, keys) {
                        index = layer.confirm('你是否确认删除【' + data[0].title + '】', {icon: 3, title: '提示', offset: '100px'}, function (index2) {
                            myTool.postMsg("DelSysImageApi", {keyid: data[0].keyid}, function () {
                                layer.close(index2);
                                tableindex.reload();
                            });
                        });
                    });
                }
            });
        });

//监听锁定操作
        form.on('checkbox(LockCom)', function (obj) {
            myTool.postMsg("LockSysImageApi", {hall_id: this.value}, function (result) {
                layer.tips(result.msg, obj.othis);
            });
        });
    });
</script>
#include("../../comm/Foot.html")